exports.request = function(app,queryResponse){


  //模拟分页方法
  function paging(reqBody, resData) {
   var page = {
     currentPage: Number(reqBody.page.currentPage),
     pageSize: Number(reqBody.page.pageSize)
   };
   var data = [];
   for (var currRow = (page.currentPage - 1) * page.pageSize; currRow < resData.length && currRow < page.currentPage * page.pageSize; currRow++) {
     data.push(resData[currRow]);
   }
   var responseValue = {
     "data": data,
     "state": '10000',
     "totalCount": resData.length
   };
   return responseValue;
  }
  //日志查询
  app.post('/sas/sysMng/log/query',function(req,res){
    var resBody = paging(req.body,queryResponse.logQuery);
    resBody.page = {
      totalCount:resBody.totalCount
    };
    res.send(resBody);
  });
  //日志备份
  app.get('/sas/sysMng/log/backup',function(req,res){
      setTimeout(function(){res.send({state:'10000'})},5000);
  });
//日志删除
  app.get('/sas/sysMng/log/delete',function(req,res){
      setTimeout(function(){res.send({state:'10000'})},3000);
  });


  //用户初始化查询
  app.post('/sas/sysMng/user/query',function (req,res) {
    var action=paging(req.body,queryResponse.userData);
    action.page={totalCount : action.totalCount };
    action.state='10000';
    res.send(action);
    // res.send(queryResponse.userData);
  });
  //新增用户保存
  app.post('/sas/sysMng/user/add',function (req,res) {
    var userData = { state : '10000',data : queryResponse.userData };
    res.send(userData);
  });
  //删除用户
  app.post('/sas/sysMng/user/delete',function (req,res) {
    res.send(queryResponse.flag);
  });
  //重置密码
  app.post('/sas/sysMng/user/pwdReset',function (req,res) {
    res.send(queryResponse.flag);
  });
  //身份证验证
  app.post('/sas/sysMng/user/checkIdCard',function (req,res) {
    res.send(queryResponse.flag);
  });
  //用户名验证
  app.post('/sas/sysMng/user/checkName',function (req,res) {
    res.send(queryResponse.flag);
  });

  //系统性能统计-------3.2
  app.post('/sas/OMdisplay/systemPerformance',function(req,res){
    var data = {};
    if(req.body.timeGra === 'month'){
      res.send({state: '10000', data: queryResponse.sysPerfmByMonth});
    }else{
      res.send({state: '10000', data: queryResponse.sysPerfmByDay});
    }
  });

  //系统性能统计.阶段响应-
  app.post('/sas/OMdisplay/systemPerformance/business',function(req,res){
    var data = queryResponse.sysPerfmPhasesByDay;
    res.send({state:'10000',data:data});
  });
  //系统性能统计.阶段响应(新增)
  app.post('/sas/OMdisplay/systemPerformance/addTime',function(req,res){
    res.send({state:'10000'});
  });
  //系统性能统计.阶段响应(删除)
  app.post('/sas/OMdisplay/systemPerformance/deleteTime',function(req,res){
    var data = queryResponse.sysPerfmPhasesByDay;
    res.send({state:'10000'});
  });
  //系统性能统计.阶段响应(修改)
  app.post('/sas/OMdisplay/systemPerformance/modifySave',function(req,res){
    var data = queryResponse.sysPerfmPhasesByDay;
    res.send({state:'10000'});
  });

  //当前健康度-------3.3
  app.post('/sas/OMdisplay/oldHealthy/current',function(req,res){
    res.send(queryResponse.currentQuanbu);
  });
  //当前健康度（下钻）
  app.post('/sas/OMdisplay/oldHealthy/current/business',function(req,res){
    var data = {};
    res.send({state: '10000', data: data});
  });
  //历史健康度
  app.post('/sas/OMdisplay/oldHealthy/history',function(req,res){
    var data = {};
    res.send({state: '10000', data: data});
  });
  //历史健康度（下钻）
  app.post('/sas/OMdisplay/oldHealthy/history/business',function(req,res){
    var data = {};
    res.send({state: '10000', data: data});
  });

  //byTime-------3.3
  app.post('/sas/OMdisplay/business/byTime',function(req,res){
    console.log(req);
    if(req.body.channelName === '' ){
      res.send({state: '10000', data: queryResponse.byTime});
    }else{
      res.send({state: '10000', data: queryResponse.byTimeAll});
    }
  });
  //byProvince
  app.post('/sas/OMdisplay/business/byProvince',function(req,res){
    if(req.body.channelName === '' ){
      res.send({state: '10000', data: queryResponse.byProvince});
    }else{
      res.send({state: '10000', data: queryResponse.byProvinceAll});
    }
  });
  //successRate
  app.post('/sas/OMdisplay/business/successRate',function(req,res){
    if(req.body.channelName === '' ){
      res.send({state: '10000', data: queryResponse.successRate});
    }else{
      res.send({state: '10000', data: queryResponse.successRateAll});
    }
  });
  //thirty
  app.post('/sas/OMdisplay/business/thirty',function(req,res){
    if(req.body.channelName === '' ){
      res.send({state: '10000', data: queryResponse.thirty});
    }else if(req.body.channelName === '' || req.body.displayMode){
      res.send({state: '10000', data: queryResponse.thirtyAll});
    }
  });

};